/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow strict-local
 * @format
 * @oncall relay
 */

'use strict';

/**
 * A unique identifier of the current actor.
 */
export opaque type ActorIdentifier = string;

const invariant = require('invariant');

const INTERNAL_ACTOR_IDENTIFIER_DO_NOT_USE: ActorIdentifier =
  'INTERNAL_ACTOR_IDENTIFIER_DO_NOT_USE';

function assertInternalActorIdentifier(actorIdentifier: ActorIdentifier): void {
  invariant(
    actorIdentifier === INTERNAL_ACTOR_IDENTIFIER_DO_NOT_USE,
    'Expected to use only internal version of the `actorIdentifier`. "%s" was provided.',
    actorIdentifier,
  );
}

module.exports = {
  INTERNAL_ACTOR_IDENTIFIER_DO_NOT_USE,
  assertInternalActorIdentifier,
  getActorIdentifier(actorID: string): ActorIdentifier {
    return actorID as ActorIdentifier;
  },
  getDefaultActorIdentifier(): ActorIdentifier {
    throw new Error('Not Implemented');
  },
};
